package com.css.zfzx.sjcj.modules.hddcB7_VolcanicDataTable.service.impl;

import cn.afterturn.easypoi.excel.entity.result.ExcelVerifyHandlerResult;
import cn.afterturn.easypoi.handler.inter.IExcelVerifyHandler;
import com.css.bpm.platform.utils.PlatformObjectUtils;
import com.css.zfzx.sjcj.common.excel.util.ActiveFaultEasyExcelVerifyHelper;
import com.css.zfzx.sjcj.modules.hddcB7_VolcanicDataTable.viewobjects.HddcB7VolcanicdatatableVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * <p>火山调查数据-火山地质调查填图数据表管理，导入校验器</p>
 *
 * @author liuhy
 * @date 2021/8/26
 */
@Component
public class VolcanoGeologySurveyDataManaExcelVerifyHandler implements IExcelVerifyHandler<HddcB7VolcanicdatatableVO> {

    private final ActiveFaultEasyExcelVerifyHelper helper;

    @Autowired
    public VolcanoGeologySurveyDataManaExcelVerifyHandler(ActiveFaultEasyExcelVerifyHelper helper) {
        this.helper = helper;
    }

    @Override
    public ExcelVerifyHandlerResult verifyHandler(HddcB7VolcanicdatatableVO vo) {
        ExcelVerifyHandlerResult result = helper.verify(vo);
        if (PlatformObjectUtils.isEmpty(vo.getElementtype())) {
            result.setSuccess(false);
            result.setMsg("元素类型不能为空");
        } else if (PlatformObjectUtils.isEmpty(vo.getFieldid())) {
            result.setSuccess(false);
            result.setMsg("野外编号不能为空");
        } else if (PlatformObjectUtils.isEmpty(vo.getReliability())) {
            result.setSuccess(false);
            result.setMsg("可靠性评估不能为空");
        }
        return result;
    }
}
